<template>
  <transition name="el-zoom-in-center">
    <div class="jsbos-preview-main">
      <div class="jsbos-common-page-header">
        <el-page-header @back="goBack" content="详情" />
        <div class="options">
          <el-button @click="goBack">取 消</el-button>
        </div>
      </div>
      <el-row
        :gutter="15"
        class="main jsbos-row-style"
        :style="{ margin: '0 16px', width: '1200px' }"
      >
        <el-form
          v-loading="loading"
          ref="elForm"
          :model="dataForm"
          size="small"
          label-width="100px"
          label-position="right"
        >
          <template v-if="!loading">
            <el-col :span="24"
              >taskDynamics
              <groupTitle content-position="left" content="基本信息">
              </groupTitle>
            </el-col>
            <el-col :span="24">
              <el-form-item label="封面" prop="cover">
                <p>{{ dataForm.cover }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="名称" prop="name">
                <p>{{ dataForm.name }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="目录" prop="categoryId">
                <p>{{ dataForm.categoryId }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="开始时间" prop="startDatetime">
                <p>{{ jsbos.dateFormat(dataForm.startDatetime) }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="截至时间" prop="endDatetime">
                <p>{{ jsbos.dateFormat(dataForm.endDatetime) }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="是否关联培训计划" prop="plan">
                <p>{{ dataForm.plan }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="培训计划" prop="planId">
                <p>{{ dataForm.planId }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="计划明细" prop="planDetailId">
                <p>{{ dataForm.planDetailId }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="预算费用" prop="budget">
                <p>{{ dataForm.budget }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="培训形式" prop="type">
                <p>{{ dataForm.type | dynamicText(typeOptions) }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="培训层级" prop="grade">
                <p>{{ dataForm.grade | dynamicText(gradeOptions) }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="介绍" prop="description">
                <p>{{ dataForm.description }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24"
              >taskDynamics
              <groupTitle content-position="left" content="阶段任务">
              </groupTitle>
            </el-col>
            <el-col :span="24">
              <el-form-item label="阶段间闯关" prop="interphaseChallenges">
                <p>{{ dataForm.interphaseChallenges }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="同步学习进度" prop="syncProgress">
                <p>{{ dataForm.syncProgress }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="逾期后可学" prop="overdueLearning">
                <p>{{ dataForm.overdueLearning }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24"
              >taskDynamics
              <groupTitle content-position="left" content="可见范围">
              </groupTitle>
            </el-col>
            <el-col :span="24">
              <el-form-item label="可见类型" prop="scopeType">
                <p>{{ dataForm.scopeType | dynamicText(scopeTypeOptions) }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24"
              >taskDynamics
              <groupTitle content-position="left" content="报名设置">
              </groupTitle>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否开启报名" prop="signUp">
                <p>{{ dataForm.signUp }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="报名人数" prop="signNum">
                <p>{{ dataForm.signNum }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="报名开始" prop="signStartDatetime">
                <p>{{ jsbos.dateFormat(dataForm.signStartDatetime) }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="报名截至" prop="signEndDatetime">
                <p>{{ jsbos.dateFormat(dataForm.signEndDatetime) }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="报名范围" prop="signOraginzeId">
                <p>{{ dataForm.signOraginzeId }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="是否需要审核" prop="signAudit">
                <p>{{ dataForm.signAudit | dynamicText(signAuditOptions) }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="学员端报名中心" prop="studentShow">
                <p>
                  {{ dataForm.studentShow | dynamicText(studentShowOptions) }}
                </p>
              </el-form-item>
            </el-col>
            <el-col :span="24"
              >taskDynamics
              <groupTitle content-position="left" content="文档学习设置">
              </groupTitle>
            </el-col>
            <el-col :span="12">
              <el-form-item label="开启文档学习时长" prop="docsLearning">
                <p>{{ dataForm.docsLearning }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="文档学习时长" prop="docsLearningLength">
                <p>{{ dataForm.docsLearningLength }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24"
              >taskDynamics
              <groupTitle content-position="left" content="通过条件">
              </groupTitle>
            </el-col>
            <el-col :span="8">
              <el-form-item label="是否必修" prop="required">
                <p>{{ dataForm.required }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="必修完成数量" prop="requiredCompleted">
                <p>{{ dataForm.requiredCompleted }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="必修总数" prop="requiredTotal">
                <p>{{ dataForm.requiredTotal }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="是否选修" prop="elective">
                <p>{{ dataForm.elective }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="选修完成数量" prop="electiveCompleted">
                <p>{{ dataForm.electiveCompleted }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="选修总数" prop="electiveTotal">
                <p>{{ dataForm.electiveTotal }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24"
              >taskDynamics
              <groupTitle content-position="left" content="学习奖励">
              </groupTitle>
            </el-col>
            <el-col :span="24">
              <el-form-item label="证书模板" prop="certificateId">
                <p>{{ dataForm.certificateId }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24"
              >taskDynamics
              <groupTitle content-position="left" content="监督人">
              </groupTitle>
            </el-col>
            <el-col :span="24">
              <el-form-item label="监督人" prop="supervisor">
                <p>{{ dataForm.supervisor }}</p>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="状态" prop="enabledMark">
                <p>
                  {{ dataForm.enabledMark | dynamicText(enabledMarkOptions) }}
                </p>
              </el-form-item>
            </el-col>
          </template>
        </el-form>
      </el-row>
    </div>
  </transition>
</template>
<script>
import request from "@/utils/request";
import PrintBrowse from "@/components/print-browse/index.vue";
import jsbos from "@/utils/jsbos";

export default {
  components: { PrintBrowse },
  props: [],
  data() {
    return {
      visible: false,
      loading: false,
      printBrowseVisible: false,
      printId: "",
      dataForm: {
        id: "",
        cover: [],
        name: "",
        categoryId: "",
        startDatetime: "",
        endDatetime: "",
        plan: 0,
        planId: "",
        planDetailId: "",
        budget: 0,
        type: "1",
        grade: "1",
        description: "",
        interphaseChallenges: 0,
        syncProgress: 0,
        overdueLearning: 0,
        scopeType: "1",
        signUp: 0,
        signNum: 0,
        signStartDatetime: "",
        signEndDatetime: "",
        signOraginzeId: [],
        signAudit: "0",
        studentShow: "1",
        docsLearning: 0,
        docsLearningLength: 0,
        required: 0,
        requiredCompleted: 0,
        requiredTotal: 0,
        elective: 0,
        electiveCompleted: 0,
        electiveTotal: 0,
        certificateId: "",
        supervisor: "",
        enabledMark: "0",
        creatorUserId: "",
        creatorTime: "",
      },
      categoryIdProps: {
        children: "children",
        label: "fullName",
        value: "enCode",
      },
      typeOptions: [
        { fullName: "内部培训", id: "1" },
        { fullName: "外部培训", id: "2" },
        { fullName: "外请培训", id: "3" },
      ],
      gradeOptions: [
        { fullName: "公司级", id: "1" },
        { fullName: "部门级", id: "2" },
      ],
      scopeTypeOptions: [
        { fullName: "全公司", id: "1" },
        { fullName: "仅创建人", id: "2" },
        { fullName: "指定人员", id: "3" },
      ],
      signAuditOptions: [
        { fullName: "需要", id: "1" },
        { fullName: "不需要", id: "0" },
      ],
      studentShowOptions: [
        { fullName: "显示", id: "1" },
        { fullName: "不显示", id: "2" },
      ],
      enabledMarkOptions: [
        { fullName: "未发布", id: "0" },
        { fullName: "已发布", id: "1" },
      ],
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    dataInfo(dataAll) {
      let _dataAll = dataAll;
      this.dataForm = _dataAll;
    },

    goBack() {
      this.$emit("refresh");
    },
    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true;
          request({
            url: "/api/course/TemsProject/detail/" + this.dataForm.id,
            method: "get",
          }).then((res) => {
            this.dataInfo(res.data);
            this.loading = false;
          });
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.jsbos-row-style {
  padding: 10px 10px 10px 0;
  >>> .el-row {
    margin: 0 !important;
    padding: 0 16px;
  }
  .el-row:nth-child(0) {
    padding: 0px !important;
  }
  >>> .el-col {
    padding: 0px !important;
    .el-form-item {
      margin-bottom: -1px !important;
      margin-right: -1px;
      border: 1px solid var(--border-4) !important;
      background-color: var(--light-blue) !important;
    }
    .el-form-item__label {
      line-height: 38px;
      height: 100%;
    }
    .el-form-item__content {
      line-height: 38px;
      padding-left: 20px;
      background-color: var(--white) !important;
      border-left: 1px solid var(--border-4) !important;
    }
  }
}
</style>
